package com.neighbor.neighborhooduser.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neighbor.neighborhooduser.pojo.Posts;
import com.baomidou.mybatisplus.extension.service.IService;
import com.neighbor.neighborhooduser.utils.ResponseMsg;
import jakarta.servlet.http.HttpServletRequest;

import java.util.List;

/**
 * <p>
 * 用户帖子表 服务类
 * </p>
 *
 * @author song
 * @since 2025-09-22 09:13:04
 */
public interface IPostsService extends IService<Posts> {

    List<Posts> getPosts(Integer page, Integer pageSize, Integer type, String title, String nickname, HttpServletRequest request);

    ResponseMsg getPostById(Integer postId,HttpServletRequest request);

    List<Posts> getHotPosts(Integer page, Integer pageSize,HttpServletRequest request);
    /**
     * 根据用户ID分页查询帖子
     */
    IPage<Posts> getPostsByUserId(Page<Posts> page, Integer userId);

    /**
     * 根据用户ID和状态分页查询帖子
     */
    IPage<Posts> getPostsByUserIdAndStatus(Page<Posts> page, Integer userId, Integer status);

    /**
     * 根据用户ID统计帖子数量
     */
    long countPostsByUserId(Integer userId);

    /**
     * 根据用户ID和状态统计帖子数量
     */
    long countPostsByUserIdAndStatus(Integer userId, Integer status);

}
